#include <bits/stdc++.h>
using namespace std;
int n;
int a;
bool bFirst = true;
int main() {
    cin >> n;
    for (int i = n; i >= 0; i--) {
        cin >> a;
        if (a == 0)
            continue;
        if (a > 0 && !bFirst)
            cout << "+";
        bFirst = false;

        if (a < 0) {
            cout << "-";
            a = -a;
        }

        if (a != 1 || i == 0)
            cout << a;

        if (i > 0)
            cout << "x";

        if (i > 1) {
            cout << "^" << i;
        }
    }
    return 0;
}